package homework01;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;

public class homework01 {
	public static void main(String[] args) throws Exception {
	FileInputStream fis = new FileInputStream("d:\\homework01.txt");
	ArrayList<Character> list = new ArrayList<>();
	int c=0;
	while((c=fis.read())!=-1){
		list.add((char)c);
	}
	fis.close();
	Collections.reverse(list);
	FileOutputStream fos = new FileOutputStream("d:\\homework01.txt");
	System.out.println(list);
	for(Character s:list){
		fos.write(s);
	}
	fos.close();
	}
}
